cmake_minimum_required(VERSION 3.10)

# 
project(qcustomplot VERSION 1.0 LANGUAGES CXX)

# 
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# 找到 Qt6 并指定需要的模块
find_package(Qt6 REQUIRED COMPONENTS 
    Core 
    Widgets
    PrintSupport
)

# 包含 Qt 的头文件目录
include_directories(${Qt6_INCLUDE_DIRS})

# 可执行文件
include_directories(include)

file(GLOB_RECURSE HEADERS "*.h")
file(GLOB SOURCES "*.cpp")

add_library(qcustomplot SHARED 
    ${SOURCES}
)

target_link_libraries(qcustomplot 
    Qt6::Core 
    Qt6::Widgets
    Qt6::PrintSupport
)

target_compile_options(qcustomplot PRIVATE $<$<CONFIG:Release>:-O3>)

# install
install(TARGETS qcustomplot DESTINATION lib)
install(FILES ${HEADERS} DESTINATION include)
